/*
Authors: Eli Yucht 300388949 and Lior Fass 300069705
Project: Hamming
Description: Hamming Encoder Decoder Class
*/

#ifndef HAMMING_EDM_H
#define HAMMING_EDM_H

#include <iostream>

using namespace std;

// hamming class declaration
class Hamming_EDM
{
public:
	static void encode_Blocks(unsigned char * hamming_blocks, int num_of_blocks);
	static int decode_Blocks(unsigned char * hamming_blocks, int num_of_blocks);


private:
	static const unsigned char hamming_MAP[5][4];
	static int count1s(unsigned char byte_in);
	static unsigned char calc_parity(unsigned char * hamming_blocks);
	static int calc_bit_num(unsigned char err);
	static void correct_bit(int bit_num, unsigned char * hamming_blocks);
	static void encode_26To31(unsigned char * hamming_blocks);
	static int decode_31To26(unsigned char * hamming_blocks);

};

#endif //HAMMING_EDM_H